package com.yzt.dynamicmodule.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.sysConfig.ReportPhotoBean;
import com.yzt.dynamicmodule.R;
import com.yzt.plugin_imageloader.ImageLoadUtil;
import com.yzt.plugin_widget.RoundFImageView;

import org.jetbrains.annotations.NotNull;

/**
 * author : bob
 * date   : 2023/2/28
 * desc   :
 */
public class DynamicAddImgAdapter extends BaseQuickAdapter<ReportPhotoBean, BaseViewHolder> {

    public DynamicAddImgAdapter() {
        super(R.layout.item_dynamic_add_img);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, ReportPhotoBean item) {
        RoundFImageView photoIv = holder.getView(R.id.photo_riv);
        if (item.getStatus() == -1) {
            photoIv.setImageResource(R.mipmap.icon_default_add_photo);
        } else {
            ImageLoadUtil.loadIvNoCache(getContext(), item.getPathUrl(), photoIv);
        }
        holder.setGone(R.id.delete_iv, item.getStatus() == -1);
    }
}
